<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\UsersExtend;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class UsersExtendController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new UsersExtend(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('uid');
            $grid->column('consult_types');
            $grid->column('text_price');
            $grid->column('voice_price');
            $grid->column('take_order_day_begin');
            $grid->column('take_order_day_end');
            $grid->column('time_limits');
            $grid->column('is_take_order');
            $grid->column('skill_ids');
            $grid->column('therapy_ids');
            $grid->column('listen_ids');
//            $grid->column('intro');
            $grid->column('technical');
            $grid->column('education');
            $grid->column('age_limit');
            $grid->column('professional');
            $grid->column('created_at');
            $grid->column('updated_at')->sortable();

            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');

            });
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new UsersExtend(), function (Show $show) {
            $show->field('id');
            $show->field('uid');
            $show->field('consult_types');
            $show->field('text_price');
            $show->field('voice_price');
            $show->field('take_order_day_begin');
            $show->field('take_order_day_end');
            $show->field('time_limits');
            $show->field('is_take_order');
            $show->field('skill_ids');
            $show->field('therapy_ids');
            $show->field('listen_ids');
//            $show->field('intro');
            $show->field('technical');
            $show->field('education');
            $show->field('age_limit');
            $show->field('professional');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new UsersExtend(), function (Form $form) {
            $form->display('id');
            $form->text('uid');
            $form->text('consult_types');
            $form->text('text_price');
            $form->text('voice_price');
            $form->text('take_order_day_begin');
            $form->text('take_order_day_end');
            $form->text('time_limits');
            $form->text('is_take_order');
            $form->text('skill_ids');
            $form->text('therapy_ids');
            $form->text('listen_ids');
//            $form->text('intro');
            $form->text('technical');
            $form->text('education');
            $form->text('age_limit');
            $form->text('professional');

            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
